﻿using FluentValidation;
using PcProject.Application.Service.AutoMapper;
using PcProject.Domain.Models.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PcProject.Application.Service.Validation
{
    public class ProductDtoValidator : AbstractValidator<ProductDto>
    {
        public ProductDtoValidator()
        {
            RuleFor(x => x.ProId).NotNull().WithMessage("主键不能为空");
            RuleFor(x => x.ProName).Length(1, 5).WithMessage("用户字符长度不符");
            RuleFor(x => x.ProType).NotNull().WithMessage("商品类型不能为空");
            RuleFor(x => x.SpeId).NotNull().WithMessage("商品规格不能为空");
            RuleFor(x => x.Price).NotNull().WithMessage("商品原价不能为空");
            RuleFor(x => x.NewPrice).NotNull().WithMessage("商品现价不能为空");
            RuleFor(x => x.PicUrl).NotNull().WithMessage("图片不能为空");
            RuleFor(x => x.Sales).NotNull().WithMessage("销量");
            RuleFor(x => x.ProAdress).NotNull().WithMessage("生产地址不能为空");
            RuleFor(x => x.SheifLife).NotNull().WithMessage("保质期不能为空");
            RuleFor(x => x.ProNum).NotNull().WithMessage("数量不能为空");
            RuleFor(x => x.Sort).NotNull().WithMessage("排序不能为空");
            RuleFor(x => x.Inventory).NotNull().WithMessage("库存不能为空");
            RuleFor(x => x.UpOrSet).NotNull().WithMessage("状态不能为空");
            RuleFor(x => x.IsDelete).NotNull().WithMessage("是否删除不能为空");
            RuleFor(x => x.AddTime).NotNull().WithMessage("添加数据不能为空");
            RuleFor(x => x.Bought).Length(1, 5).WithMessage("买过");
            RuleFor(x => x.Business).NotNull().WithMessage("商家不能为空");

        }
    }
}
